package com.gzdh.device.comm.util;

import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

import static com.baomidou.mybatisplus.core.toolkit.Constants.MD5;

/**
 * @author
 */
@Component
public class DefaultPasswordEncoder implements PasswordEncoder {

    public DefaultPasswordEncoder() {
        this(-1);
    }
    public DefaultPasswordEncoder(int strength) {
    }
    //进行MD5加密
    @Override
    public String encode(CharSequence charSequence) {
        System.out.println("charSequence.toString()"+charSequence.toString());
        return charSequence.toString();
    }

    /**
     * 进行密码比对
     * @param charSequence 加密后的密码
     * @param encodedPassword 传入的密码
     * @return
     */
    @Override
    public boolean matches(CharSequence charSequence, String encodedPassword) {
        return encodedPassword.equals(charSequence.toString());
    }
}

